import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import java.awt.GridLayout;
import javax.swing.JEditorPane;
import javax.swing.JTable;


public class Grille extends JFrame {

	private JPanel contentPane;
	private JTable table;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					String[][] echequier = {{"1","2","3"},{"1","2","3"},{"1","2","3"}};
					Grille frame = new Grille(10);
					frame.setVisible(true);
					frame.refresh(echequier);
					String[][] echequier2 = {{"2","3","4"},{"2","3","4"},{"2","3","4"}};
					frame.refresh(echequier2);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public Grille(int taille) {
		setResizable(true);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, taille*50,taille*50);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(new BorderLayout(0, 0));
		table = new JTable(taille,taille);	
		contentPane.add(table, BorderLayout.CENTER);
		table.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
	}
	public void refresh(String[][] echequier) {
		for (int i =0;i<echequier.length;i++)
			for(int j=0;j<echequier.length;j++)
				table.setValueAt(echequier[i][j],j,i);
		
	}

}
